/*
 * @lc app=leetcode.cn id=334 lang=typescript
 *
 * [334] 递增的三元子序列
 */

// @lc code=start
function increasingTriplet(nums: number[]): boolean {
    if (nums.length < 3) {
        return false;
    }
    const size = nums.length;
    let first = nums[0];
    let second = Number.MAX_SAFE_INTEGER;
    for (let i = 0; i < size; i++) {
        if (nums[i] > second) {
            return true
        } else if (nums[i] > first) {
            second = nums[i];
        } else {
            first = nums[i];
        }
    }
    return false;
}
// increasingTriplet([1, 5, 0, 4, 1, 3]);

// @lc code=end
